package com.alibaba.citrus.cr.price.ability.functions.factory.price.process;

import org.apache.commons.collections.CollectionUtils;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author hanguo
 * @date 2021/11/19
 * @Description 价格列表属性处理器
 */

public abstract class PriceProcess {
    /**
     * 获取编码和描述的对应关系
     * @param codeList
     * @param innerCode
     * @return
     */
    public abstract Map<String,String> obtainCodeAndDescMap(List<String> codeList,boolean innerCode);


    /**
     * 获取内外部编码的对应关系
     * @param codeList
     * @param innerCode
     * @return
     */
    public abstract Map<String,String> obtainInnerCodeAndOuterCodeMap(List<String> codeList,boolean innerCode);
    /**
     * 获取查询的属性编码
     * @return
     */
    public abstract String getPropertyCode();

    /**
     * 入参处理
     * @param codeList
     * @return
     */
    public List<String> dealCodeList(List<String> codeList){
        if(CollectionUtils.isEmpty(codeList)){
            return null;
        }

        codeList.remove(null);

        if (CollectionUtils.isEmpty(codeList)) {
            return null;
        }

        return codeList.stream().distinct().collect(Collectors.toList());


    }

}
